//
//  JSCallback.m
//  Manager
//
//  Created by issac on 15/8/31.
//  Copyright (c) 2015年 52xiaoluo. All rights reserved.
//

#import "JSCallback.h"

@implementation JSCallback {
    int index;
}

-(id) initWithIndex:(int)callbackIndex {
    if (self) {
        index = callbackIndex;
    }
    return self;
}

-(void) apply:(NSString *)value {
    NSString *str = [[NSString alloc] initWithFormat:@"javascript:%@.callback(%d, \"%@\");",@"JSBridge",index,value];
    DLog(@"callback=%@",str);
    if (self.webview) {
        [self.webview stringByEvaluatingJavaScriptFromString:str];
    }
}
@end
